FROM debian:13.2-slim AS build
ARG R_V
ADD redis-${R_V}.tar.gz  /usr/local/
WORKDIR /usr/local/redis-${R_V}
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
apt-get -y update && apt-get -y upgrade && \
# 编译必需的软件包列表
apt-get -y install build-essential  pkg-config && \
make && make install PREFIX=/usr/local/redis-${R_V} && \
mkdir myCopy && cp bin/* redis.conf sentinel.conf myCopy
FROM debian:13.2-slim
ENV TZ=Asia/Shanghai
ARG R_V
COPY --from=build /usr/local/redis-${R_V}/myCopy /usr/local/redis-${R_V}
WORKDIR /usr/local/redis-${R_V}/
CMD ["./redis-server","redis.conf"]

# tar -czvf redis-6.2.21.tar.gz redis-6.2.21/
# https://download.redis.io/releases/
# Redis-6.0.20
# docker build --build-arg R_V=6.0.20 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.0.20 .
# docker run -d -p 6379:6379 --name redis60 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.0.20
# docker run -it --rm --name redis60 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.0.20 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.0.20
# Redis-6.2.21
# docker build --build-arg R_V=6.2.21 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.2.21 .
# docker run -d -p 6379:6379 --name redis62 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.2.21
# docker run -it --rm --name redis62 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.2.21 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:6.2.21
# Redis-7.0.15
# docker build --build-arg R_V=7.0.15 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.0.15 .
# docker run -d -p 6379:6379 --name redis70 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.0.15
# docker run -it --rm --name redis70 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.0.15 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.0.15
# Redis-7.2.12
# docker build --build-arg R_V=7.2.12 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.2.12 .
# docker run -d -p 6379:6379 --name redis72 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.2.12
# docker run -it --rm --name redis72 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.2.12 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.2.12
# Redis-7.4.7
# docker build --build-arg R_V=7.4.7 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.4.7 .
# docker run -d -p 6379:6379 --name redis74 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.4.7
# docker run -it --rm --name redis74 registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.4.7 bash
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/redis:7.4.7